#if !defined(AFX_SERVERSOCKET_H__AD335126_529C_46E6_B6AD_340516E9DD24__INCLUDED_)
#define AFX_SERVERSOCKET_H__AD335126_529C_46E6_B6AD_340516E9DD24__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ServerSocket.h : header file
//

#include "..\..\CommonLibs\CommonLib\Log.h"

/////////////////////////////////////////////////////////////////////////////
// CServerSocket command target

class Packet;

class CServerSocket : public CAsyncSocket
{
	// Attributes
public:
	LPBYTE m_lpbySendBuf;
	int m_nSendDataLen;
	int m_nBytesSent;

	LPBYTE m_lpbyRecvBuf;
	int m_nRecvDataLen;
	int m_nBytesRecv;

	int m_nRecvStatus;
	enum {RecvId, RecvLength, RecvData};

	DWORD m_dwId;
	DWORD m_dwDataSize;

	// Operations
public:
	CServerSocket();
	virtual ~CServerSocket();

	void Init();
	void AsyncSend(Packet * pPacket);
	void SetbStop(bool bStop){m_bStop = bStop;}

	// Overrides
public:
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CServerSocket)
public:
	virtual void OnClose(int nErrorCode);
	virtual void OnReceive(int nErrorCode);
	virtual void OnSend(int nErrorCode);
	//}}AFX_VIRTUAL

	// Generated message map functions
	//{{AFX_MSG(CServerSocket)
	// NOTE - the ClassWizard will add and remove member functions here.
	//}}AFX_MSG

	// Implementation
protected:
	void DoAsyncSend();
	bool m_bStop;
	CLog *pLog;
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_SERVERSOCKET_H__AD335126_529C_46E6_B6AD_340516E9DD24__INCLUDED_)
